<?php
class Mfile extends CI_Model
{
	function __construct()
	{
		parent::__construct();
		$this->tablename = 'yun_files';
	}
	
	function get_one($fid) {
		$item = new stdClass();
		$query = $this->db->query('select * from '.$this->tablename.' where fid = '.$fid);
		if ($query->num_rows() > 0) {
			$item = current($query->result());
		}
		$query->free_result();
		return $item;
	}

    function insert($arr){
		$this->db->insert($this->tablename,$arr);
		return  $this->db->insert_id(); 
    }

    function update($id,$arr)
    {
        $this->db->where('fid',$id);
        $this->db->update($this->tablename,$arr);
    }

    function delete($id){
        $this->db->where('fid',$id);
        $this->db->delete($this->tablename);
    }

}